<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no" />
  <title>首页</title>
  <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
</head>
<style>
  * {
    margin: 0;
    padding: 0;
  }

  body {
    background: #000;
  }

  .progress {
    width: 0;
    height: 3px;
    background: rgb(253, 80, 80);
    box-shadow: 0 0 10px 2px rgb(255, 115, 115);
    position: fixed;
    top: 0;
    transition: all 1s;
  }
</style>

<body>
  <div class="progress"></div>
</body>

<script>

  let progress = document.querySelector('.progress')
  if (document.readyState === 'loading') {
    progress.style.width = "10%"

  }
  document.onreadystatechange = () => {
    if (document.readyState === 'interactive') {
      progress.style.width = "50%"
    }
    if (document.readyState === 'complete') {
      progress.style.width = "100%"
      setTimeout(() => {
        progress.style.display = "none"
      }, 500)
    }
  }
</script>

</html>